<!--
 * @Description: 
 * @Author: mmzhang
 * @Date: 2022-07-14 14:13:44
 * @LastEditTime: 2022-11-02 14:02:55
-->
<template>
  <div class="flex tips" v-if="tips!=''">
    <p>
      <Icon type="md-warning" :size="20" color="#13227a"
        style="line-height:26px;margin-right:10px;" />
      {{tips}}</p>
    <span @click="linkOrder">查看详情</span>
    <span @click="alreadyKnowFun"
      v-if="this.detailMsg.orAdjustmentVO.status=='NO_PASS'">我知道了</span>
  </div>
</template>
<script>
  import adjustMgr from '@/biz/sales/adjustOrder'
  export default {
    props: ['detailMsg', 'buildingId', 'orderStatusName'],
    data() {
      return {
        isView: this.$route.meta.isbuild == 'nobuildpage' ? true : false, // 是否是汇总数据跳转
        tips: ''
      }
    },
    mounted() {
      let orderCode = this.detailMsg.orContractBaseInfoVO.contractCode
      if (this.detailMsg.orAdjustmentVO) {
        if (this.orderStatusName == '认购') {
          if (this.detailMsg.orAdjustmentVO.status == 'APPROVAL') {
            this.tips = `该认购单（编号：${orderCode}）已发起“认购单调整”申请`
          } else if (this.detailMsg.orAdjustmentVO.status == 'NO_PASS') {
            this.tips = `该认购单（编号：${orderCode}）的“认购单调整”申请被驳回`
          }
        } else {
          if (this.detailMsg.orAdjustmentVO.status == 'APPROVAL') {
            this.tips = `该签约单（编号：${orderCode}）已发起“签约单调整”申请`
          } else if (this.detailMsg.orAdjustmentVO.status == 'NO_PASS') {
            this.tips = `该签约单（编号：${orderCode}）的“签约单调整”申请被驳回`
          }
        }
      }
    },
    methods: {
      linkOrder() {
        let adjustItem = this.detailMsg.orAdjustmentVO
        let orderParams = {
          orderNum: adjustItem.adjustNo, // 单号
          businessId: adjustItem.adjustmentId, //业务id
          orderType: this.orderStatusName
        }
        this.linkOrderFun(orderParams)
      },
      alreadyKnowFun() {
        let params = {
          adjustmentDetailId: this.detailMsg.orAdjustmentVO.adjustmentDetailId
        }
        adjustMgr.updateAdjustmentPromptStatusFun(params).then(res => {
          this.$emit('onOrderDetail')
        }).catch(err => {})
      }
    }
  }
</script>
<style lang="scss" scoped>
  .tips {
    padding: 0px 20px;
    margin-bottom: 20px;
    background-color: rgba(254, 252, 236, 1);
    display: flex;
    align-items: center;

    p {
      line-height: 50px;
    }

    span {
      margin-left: 30px;
      color: #2d8cf0;
      cursor: pointer;
    }
  }
</style>